import java.util.Arrays;

import static java.lang.Long.reverse;

public class Test {



    public static void rotate(int[] nums, int k) {

        int len = nums.length;//数字下标最大值
        int[] arr = new int[len];
        for (int i = 0; i < len; i++) {
           arr[(i+k)%len] = nums[i];
        }

        for (int i = 0; i < len; i++) {
            nums[i] = arr[i];
        }
        System.out.println(Arrays.toString(nums));
    }

    public static void main(String[] args) {
        int[] nums = {99, 0, 3, -100};
        rotate(nums,2);
    }
    public static int missingNumber(int[] nums) {
        int len = nums.length+1;
        int[] flag = new int[len];
        for(int i = 0;i<len-1;i++) {
            flag[nums[i]]++;
        }
        int i = 0;
        for(;i<len;i++) {
            if(flag[i]!=1){
              break;
            }
        }
        return i;
    }
    public static void main1(String[] args) {
        //消失的数字
        int[] nums = {9,6,4,2,3,5,7,0,1};
        int ret = missingNumber(nums);
        System.out.println(ret);
    }
}
